//////////////////////////////////////////////////////////////////////////////////
//
//	4:20 Announcement
//		- Version 1.0
//		- 04.18.2008
//		- diamond-optic
//
//////////////////////////////////////////////////////////////////////////////////
//
// Information:
//
// - At 4:20 (server time) there will be a
//   chat, hud, and vox annoucement.
//
// Changelog:
//
// - 02.23.2006 Version 0.1
//	Initial testing and shit
//
// - 03.05.2006 Version 0.2
//	Removed the time cvar
//	Fixed vox message
//	Added print_chat
//
// - 03.07.2006 Version 0.3
//	Add the time cvar back for testing
//	Changed hud channels
//
// - 03.14.2006 Version 0.4
//	Cleaned up for release
//
// - 04.18.2006 Version 0.5
//	Added HudSync
//	Dont bother for bots...
//
// - 06.03.2006 Version 0.6
//	Fixed MAXPLAYERS define
//
// - 08.06.2006 Version 0.6b
//	Changed a return
//
// - 12.18.2007 Version 0.7 (never released)
//	Fixed the stupidest mistake ive ever made
//
// - 04.18.2008 Version 1.0
//	Release of a working version
//
//////////////////////////////////////////////////////////////////////////////////

#include <amxmodx>

#define VERSION "1.0"
#define SVERSION "v1.0 - by diamond-optic (www.AvaMods.com)"

#define MAXPLAYERS 32

new stoner_time[16]
new g_smoke_sync, g_smoke2_sync

public plugin_init()
{
	register_plugin("AMX 420",VERSION,"diamond-optic")
	register_cvar("amx_420_stats",SVERSION,FCVAR_SERVER|FCVAR_SPONLY)
	
	g_smoke_sync = CreateHudSyncObj()
	g_smoke2_sync = CreateHudSyncObj()
	
	set_task(60.0,"smoke_time",1,"",0,"b")		//set the task to check the time...
}

public smoke_time()
{
	get_time("%H%M",stoner_time,16)			//get the current time
	
	if(equal(stoner_time,"1620"))			//do the announcement if its 420
		{
		client_cmd(0,"spk ^"vox/dadeda _comma it is now four twenty _period _period please light up some green organic immediately^"")
		client_print(0, print_chat,"The time is now 4:20...")
		set_hudmessage(49,134,49,-1.0,0.02,2,0.6,30.0,0.3,0.3) //was chan 4
		
		for(new i=1;i <= MAXPLAYERS;i++)
			if(is_user_connected(i) && !is_user_bot(i))
				ShowSyncHudMsg(i,g_smoke_sync,"The Time Is Now^n4:20")		
		
		set_hudmessage(49,134,49,-1.0,0.85,1,1.0,30.0,0.5,0.5) //was chan 3

		for(new i=1;i <= MAXPLAYERS;i++)
			if(is_user_connected(i) && !is_user_bot(i))
				ShowSyncHudMsg(i,g_smoke2_sync,"** 4:20 **")	
		}
		
	return PLUGIN_HANDLED
}
